using System.Collections.Generic;
using SkaldRogueLike.Main.CellContent.Items;
using SkaldRogueLike.Main.Constants.Enumerations;

namespace SkaldRogueLike.Main.CellContent.Creatures
{
    public abstract class Creature : CellContent
    {
        public int HP { get; protected set; }
        public int Att { get; protected set; }
        public int Def { get; protected set; }

        protected Inventory Inventory { get; set; }
        
        protected Creature(string name, string image, Colors color, string description) : 
            base(name, image, color, description)
        {
            Inventory = new Inventory();
        }

        public void PickUp(Item item)
        {
            Inventory.PutInBag(item);
        }

        public void Drop(Item item)
        {
            Inventory.Drop(item);
        }

        public List<Item> GetItemsFromBag()
        {
            return Inventory.GetItemsFromBag();
        }

        public abstract int Attack(Creature creature);
        public abstract int TakeDamage(int damage);

        public virtual void Move(Direction way)
        {
            switch (way)
            {
                case Direction.North:
                    Y -= 1;
                    break;
                case Direction.NorthEast:
                    Y -= 1;
                    X += 1;
                    break;
                case Direction.East:
                    X += 1;
                    break;
                case Direction.SouthEast:
                    X += 1;
                    Y += 1;
                    break;
                case Direction.South:
                    Y += 1;
                    break;
                case Direction.SouthWest:
                    X -= 1;
                    Y += 1;
                    break;
                case Direction.West:
                    X -= 1;
                    break;
                case Direction.NorthWest:
                    X -= 1;
                    Y -= 1;
                    break;
            }
        }
    }
}